﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.IO;

namespace ebay.Utility
{
    public class XmlHelper
    {
        public static T XmlDeserialize<T>(string xmlString)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(T));
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(xmlString));
            return (T)serializer.Deserialize(stream);
        }
        public static string XmlSerializer<T>(T t)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(T));
            MemoryStream stream = new MemoryStream();
            serializer.Serialize(stream, t);
            string str = Encoding.UTF8.GetString(stream.ToArray());
            return str;
        }

    }
}
